Hello, I’m new to exchange and power shell I’m having difficulties to get this right; I’m trying to get the mailbox size of a list of specific alias from a csv file. this is what I’m doing:

Import-CSV c:\temp\dupsmbx.csv
$accounts = Get-Mailbox -Identity $_.Alias

Write-Host “Accounts Objects found: $($accounts.count)”

$index = 0
$accounts | ForEach-Object{
$index++;
Write-Host "Working with: $($.Alias) ----> Processesing $index/$($accounts.Count)"
Get-MailboxStatistics $
.alias | Select-Object DisplayName, TotalItemSize, ItemCount, LastLogonTime | Export-CSV c:\temp\DupsMailbox-Report.csv -NoTypeInformation
Get-Date
}

The thing is that the script gets me back the first 1000 results instead of the specific alias from the csv :frowning:

3 Spice ups

Welcome!

When you post code, Pease use the insert code button! Please and thank you

codebutton_small.png

#Thank you, will do.

How about like so?

foreach($mailbox in (Import-CSV c:\temp\dupsmbx.csv)){
    Get-MailboxStatistics $mailbox.alias | 
    Select-Object DisplayName, TotalItemSize, ItemCount, LastLogonTime | 
    Export-CSV c:\temp\DupsMailbox-Report.csv -NoTypeInformation -Append
}

Though I’m not sure if ‘Get-MailboxStatistics’ has the info you are trying to get with ‘select-object’

1 Spice up

Hi Neally! Thank you for the quick reply! It works and gets the info as intended!

Thank you!